package modelo.servicio;

import modelo.bd.dao.HistoricoDAO;
import modelo.bd.excepcion.DAOException;
import modelo.dominio.Historico;

public class Historicos {
    private static Historicos instancia;
    private HistoricoDAO dao;

    private Historicos() {
        this.dao = new HistoricoDAO();
    }

    public static Historicos instancia() {
        if (instancia == null) {
            instancia = new Historicos();
        }
        return instancia;
    }

    @Override
    protected Object clone() throws CloneNotSupportedException {
        return new CloneNotSupportedException("No se puede clonar Historicos.");
    }

    public Historico obtenerPorId(int idHistorico) throws DAOException {
        return dao.selectWhere("ID_HISTORICO = " + idHistorico).get(0);
    }
}
